// 更新或创建配置
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	// console.log('event : ', event)
	const data = {open_id:event.open_id, exchange_domain:event.exchange_domain, strategy_name:event.strategy_name}
	// console.log('data : ', data)
	const res = await db.collection('config').where(data).get()
	// console.log('数据', res)
	if (res.affectedDocs === 0) {
		return { code: 400, 'msg': '用户数据不存在' }
	} else{
		return { data: res.data[0], code: 200, 'msg': 'ok' }
	}
	
};
